import {_get, _delete, _post, _put, _patch} from './http';
var version = 'v1'

//登陆
// export const loginApi = params => { return _post(`/${version}/users/login`, params) }
// export const registerApi = params => { return _post(`/${version}/users/register`, params) }

// dj-rest-auth注册
// url = host + '/dj-rest-auth/registration/'
// data = {
    // 'username':'shuishui',
    // 'email':'shuishui@126.com',
    // 'password1':'shuiqing1234',
    // 'password2':'shuiqing1234',
// }
export const registerApi = params => { return _post(`/dj-rest-auth/registration/`, params) }

// dj-rest-auth登陆
// url = host + '/dj-rest-auth/login/'
// data = {
    // 'username':'qingqing',
    // 'password':'shuiqing12345'
// }
export const loginApi = params => { return _post(`/dj-rest-auth/login/`, params) }



// // tupu
// export const nlpDepartment= params => { return _get(`/department/`, params) }
// export const getJianCha = params => { return _get(`/jiancha/`, params) }
// export const getZhengZhuang = params => { return _get(`/zhengzhuang/`, params) }
// export const getJiBing = params => { return _get(`/jibing/`, params) }
// // search
// export const searchJianCha = params => { return _get(`/jiancha_search/`, params) }
// export const searchZhengZhuang = params => { return _get(`/zhengzhuang_search/`, params) }
// export const searchJiBing = params => { return _get(`/jibing_search/`, params) }
// // _getUseId
// export const getJianChaUseId = params => { return _get(`/jiancha/${params.id}`) }
// export const getZhengZhuangUseId = params => { return _get(`/zhengzhuang/${params.id}`) }
// export const getJiBingUseId = params => { return _get(`/jibing/${params.id}`) }


// 策略
export const getIndicatorStatistic = params => { return _get(`/strategy/statistic`, params)}
export const getStrategyStock = (id,params) => { return _get(`/strategy/${id}/trigger_stock`, params)}
export const getStockTriggerStatistic = params => { return _get(`/strategy/trigger/statistic`, params)}

// 股票
export const getStocks = params => { return _get(`/stock`) }
export const SearchStocks = params => { return _get(`/stock/search`, params)}
export const getDaily = params => { return _get(`/stock/${params.ts_code}/daily`)}
export const getStockStrategy = (ts_code,params) => { return _get(`/stock/${ts_code}/strategy`, params)}

// 策略管理
export const getStrategy = params => { return _get(`/strategy`) }
export const createStrategy = params => { return _post(`/strategy`, params)}
export const updateStrategy = (id,params) => { return _put(`/strategy/${id}`, params)}
export const deleteStrategy = id => { return _delete(`/strategy/${id}`)}

// 指标管理
export const getIndicator = params => { return _get(`/indicator`) }
export const createIndicator = params => { return _post(`/indicator`, params)}
export const updateIndicator = (id,params) => { return _put(`/indicator/${id}`, params)}
export const deleteIndicator = id => { return _delete(`/indicator/${id}`)}

// 回测
export const getBacktestList = params => { return _get(`/backtest`)}
export const createIncomeTimeBacktest = params => { return _post(`/backtest/income_times_run`, params)}
export const killBacktest = id => { return _get(`/backtest/${id}/kill`)}
export const getBacktestRecordList = id => { return _get(`/backtest/${id}/record`)}
export const getOneBacktest = id => { return _get(`/backtest/${id}`)}
export const deleteBacktest = id => { return _delete(`/backtest/${id}`)}
